package com.fingard.dsp.bank.reqrespobj.pushinfotobank.detail;

import com.fingard.FGBiz;
import com.fingard.dsp.core.specialdeal.PayStateHelper;
import com.fingard.xml.XmlTextWriter;

public class RetAtsTransResultDetail {
    public String respCode;
    public String respInfo;
    public String reqSeqID;
    public String transState;
    public String payInfoCode;

    public void writeToXml(XmlTextWriter retXmlWriter, String p_bankCode, String p_transType) throws Exception {
        retXmlWriter.writeStartElement("DetailRecord");

        if (FGBiz.dspCenter.convertPayState && respCode.equals("0")) {
            PayStateHelper payStateHelper = new PayStateHelper(p_bankCode, p_transType, respInfo, transState, payInfoCode);
            payStateHelper.toBank();
            transState = payStateHelper.payState;
            payInfoCode = payStateHelper.payInfo;
        }

        retXmlWriter.writeElementString("RespCode", respCode);
        retXmlWriter.writeElementString("RespInfo", respInfo);
        retXmlWriter.writeElementString("TransState", transState);
        retXmlWriter.writeElementString("ReqSeqID", reqSeqID);
        retXmlWriter.writeElementString("PayInfoCode", payInfoCode);
        retXmlWriter.writeEndElement();
    }
}
